<template>
	<view>
		<video class="VideoStyle" id="myVideo" src="https://img.wilmer.com.cn/%E8%8B%B1%E5%9B%BD%E4%B8%80%E5%B9%B4%E5%88%B6%E7%A1%95%E5%A3%AB%E7%94%B3%E8%AF%B7%E7%95%99%E5%AD%A6%E2%80%9C%E6%B8%85%E5%8D%95%E2%80%9D%E6%8C%87%E5%8D%97.mp4"
			controls></video>
		<view class="describe">根据您的个人信息，为您推荐一下院校</view>
		<view v-if="list.length > 0">
			<view class="nav" v-for="(item,index) in list" :key="index" @click="onclick(item)">
				<view class="left">
					<image class="logo" :src="item.logo" mode=""></image>
					<view class="details">
						<view class="title">{{item.name}}</view>
						<view class="speciality uni-ellipsis-1">地址：<text>{{item.city}}</text></view>
						<view class="speciality">概率：<text>{{((Number(item.gl)) * 100).toFixed(1)}}%</text></view>
					</view>
				</view>
				<image class="right" src="https://img.wilmer.com.cn/admin/2024/3-14/WechatIMG267.jpg" mode=""></image>
			</view>
		</view>
		<image v-if="list.length == 0" class="NoData" src="https://img.wilmer.com.cn/admin/2024/3-20/WechatIMG19.jpg"
			mode=""></image>
		<image @click="onReport()" class="Report" src="https://img.wilmer.com.cn/admin/2024/3-20/WechatIMG15.jpg"
			mode=""></image>
	</view>
</template>

<script>
	import {
		report29,
		report399,
		report99
	} from '@/common/api/homePage.js'
	export default {
		data() {
			return {
				list: [], // 推荐院校

				report: {}, // AI报告
				currindex: null,
			
			}
		},
		onLoad(option) {
			this.report = JSON.parse(option.report)
			this.currindex = option.currindex
			if (this.currindex == 0) {
				report29(this.report).then(res => {
					console.log(res)
					this.list = res.data.data.schools
				})
			} else if (this.currindex == 1) {
				report399(this.report).then(res => {
					console.log(res)
					this.list = res.data.data.schools
				})
			} else {
				report99(this.report).then(res => {
					console.log(res)
					this.list = res.data.data.schools
				})
			}
		},
		methods: {
			onclick(item) {
				uni.navigateTo({
					url: `/pages/school/Institution-Details?id=${item.id}`
				})
			},
			onReport() {
				uni.navigateTo({
					url: `/pages/knowledge/AI_Report?report=${JSON.stringify(this.report)}&currindex=${this.currindex}`
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		width: 100%;
		height: auto;
		background: #F7F7F8;
		overflow-x: hidden;
	}
</style>

<style lang="scss" scoped>
	.uni-ellipsis-1 {
		display: -webkit-box;
		overflow: hidden;
		text-overflow: ellipsis;
		word-wrap: break-word;
		white-space: normal !important;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}
	
	.VideoStyle {
		width: 686rpx;
		height: 400rpx;
		margin: 30rpx auto 0;
		display: block;
	}

	.describe {
		margin-top: 24rpx;
		margin-left: 54rpx;
		font-family: PingFang SC;
		font-size: 28rpx;
		font-weight: 400;
		letter-spacing: 0.03em;
		color: #666666;
	}

	.nav {
		margin-top: 12rpx;
		width: 100vw;
		height: 224rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		background-color: #fff;

		.left {
			margin-left: 48rpx;
			display: flex;

			.logo {
				width: 152rpx;
				height: 152rpx;
				min-width: 152rpx;
				min-height: 152rpx;
				margin-right: 10rpx;
			}

			.details {
				display: flex;
				flex-direction: column;

				.title {
					font-family: PingFang SC;
					font-size: 36rpx;
					font-weight: 500;
					letter-spacing: 0.03em;
				}

				.speciality {
					margin-top: 10rpx;
					font-family: PingFang SC;
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;

					text {
						font-family: PingFang SC;
						font-size: 28rpx;
						font-weight: 400;
						letter-spacing: 0.03em;
						color: #666666;
					}
				}
			}
		}

		.right {
			width: 24rpx;
			height: 40rpx;
			margin-right: 68rpx;
		}
	}

	.Report {
		width: 100rpx;
		height: 100rpx;
		position: fixed;
		right: 26rpx;
		bottom: 200rpx;
	}

	.NoData {
		display: block;
		width: 400rpx;
		height: 318rpx;
		margin: 40rpx auto 0;
	}
</style>